/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package models;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Eduardo
 */
@Entity
@Table(name = "Reserva_Cubiculo")
@NamedQueries({
    @NamedQuery(name = "ReservaCubiculo.findAll", query = "SELECT r FROM ReservaCubiculo r"),
    @NamedQuery(name = "ReservaCubiculo.findByNumeroReservaCub", query = "SELECT r FROM ReservaCubiculo r WHERE r.numeroReservaCub = :numeroReservaCub"),
    @NamedQuery(name = "ReservaCubiculo.findByFechaRes", query = "SELECT r FROM ReservaCubiculo r WHERE r.fechaRes = :fechaRes"),
    @NamedQuery(name = "ReservaCubiculo.findByHoraIni", query = "SELECT r FROM ReservaCubiculo r WHERE r.horaIni = :horaIni"),
    @NamedQuery(name = "ReservaCubiculo.findByHoraFin", query = "SELECT r FROM ReservaCubiculo r WHERE r.horaFin = :horaFin"),
    @NamedQuery(name = "ReservaCubiculo.findByEstado", query = "SELECT r FROM ReservaCubiculo r WHERE r.estado = :estado")})
public class ReservaCubiculo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "NumeroReservaCub")
    private Integer numeroReservaCub;
    @Column(name = "FechaRes")
    @Temporal(TemporalType.DATE)
    private Date fechaRes;
    @Column(name = "HoraIni")
    @Temporal(TemporalType.TIME)
    private Date horaIni;
    @Column(name = "HoraFin")
    @Temporal(TemporalType.TIME)
    private Date horaFin;
    @Column(name = "Estado")
    private Integer estado;
    @JoinColumn(name = "IdCubiculo", referencedColumnName = "IdCubiculo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Cubiculo idCubiculo;
    @JoinColumn(name = "IdUsRes", referencedColumnName = "IdUsuario")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private UsuarioBiblioteca idUsRes;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "reservaCubiculo", fetch = FetchType.LAZY)
    private List<DetalleReservaCubiculo> detalleReservaCubiculoList;

    public ReservaCubiculo() {
    }

    public ReservaCubiculo(Integer numeroReservaCub) {
        this.numeroReservaCub = numeroReservaCub;
    }

    public Integer getNumeroReservaCub() {
        return numeroReservaCub;
    }

    public void setNumeroReservaCub(Integer numeroReservaCub) {
        this.numeroReservaCub = numeroReservaCub;
    }

    public Date getFechaRes() {
        return fechaRes;
    }

    public void setFechaRes(Date fechaRes) {
        this.fechaRes = fechaRes;
    }

    public Date getHoraIni() {
        return horaIni;
    }

    public void setHoraIni(Date horaIni) {
        this.horaIni = horaIni;
    }

    public Date getHoraFin() {
        return horaFin;
    }

    public void setHoraFin(Date horaFin) {
        this.horaFin = horaFin;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    public Cubiculo getIdCubiculo() {
        return idCubiculo;
    }

    public void setIdCubiculo(Cubiculo idCubiculo) {
        this.idCubiculo = idCubiculo;
    }

    public UsuarioBiblioteca getIdUsRes() {
        return idUsRes;
    }

    public void setIdUsRes(UsuarioBiblioteca idUsRes) {
        this.idUsRes = idUsRes;
    }

    public List<DetalleReservaCubiculo> getDetalleReservaCubiculoList() {
        return detalleReservaCubiculoList;
    }

    public void setDetalleReservaCubiculoList(List<DetalleReservaCubiculo> detalleReservaCubiculoList) {
        this.detalleReservaCubiculoList = detalleReservaCubiculoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numeroReservaCub != null ? numeroReservaCub.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReservaCubiculo)) {
            return false;
        }
        ReservaCubiculo other = (ReservaCubiculo) object;
        if ((this.numeroReservaCub == null && other.numeroReservaCub != null) || (this.numeroReservaCub != null && !this.numeroReservaCub.equals(other.numeroReservaCub))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "models.ReservaCubiculo[ numeroReservaCub=" + numeroReservaCub + " ]";
    }
    
}
